package main

import "fmt"

func main() {
	// totalCost, change := 8.50, 1.50
	// var totalCost, change = 8.50, 1.50
	// var totalCost, change float64 = 8.50, 1.50
	// var name, age:= "Bogdan", 25
	// var name string
	// var age int
	// name, age = "Bogdan", 25
	// fmt.Println(name, age)
	totalCost, change := processPayment(6.50, 2.00, 10.00) //声明变量并赋值
	fmt.Printf("Total cost (with tip): $%.2f\n", totalCost)

	fmt.Printf("Change returned to the customer: $%.2f\n", change)

	fmt.Println("_____________________________________")

	totalCost, change = processPayment(28.50, 1.50, 50.00) // 变量已声明，直接赋值
	fmt.Printf("Total cost (with tip): $%.2f\n", totalCost)

	fmt.Printf("Change returned to the customer: $%.2f\n", change)

}

func processPayment(orderTotal float64, tip float64, amountPaid float64) (float64, float64) {
	totalAmountDue := orderTotal + tip
	change := amountPaid - totalAmountDue

	return totalAmountDue, change
}
